/*
 * Utils.h
 */
 
#ifndef UTILS_H_
#define UTILS_H_

#define CONFIGURATION_PATH "configuracion.txt"

#include <iostream>
#include <sstream>
#include <fstream>
using std::string;
using std::istringstream;
using namespace std;

class Utils {
public:
	Utils() {};
	virtual ~Utils() {};

	static float PI;

	/**
	 * Utility method to tokenize strings
	 */
	static string* stringTokenize(string str, char delimiter, int& tokenCount);
	/**
	 * Utility method to convert from String to float
	 */
	static float stringToFloat(string s);
	/**
	 * Utility method to convert from String to int
	 */
	static int stringToInt(string s);
	/**
	* Utility method to get the min value between two floats
	*/
	static float min(float arg1, float arg2);
	/**
	* Utility method to get the min value between four ints
	*/
	static int min(int arg1, int arg2, int arg3, int arg4);
	/**
	* Utility method to get the max value between four ints
	*/
	static int max(int arg1, int arg2, int arg3, int arg4);

	static int max(int arg1, int arg2);
	/**
	* Utility method to get the positive value of a float
	*/
	static float abs(float a);

	static float toDeg(float rad);
	/**
	* Utility method to validate if a number is even or odd
	*/
	static bool esPar(int numero);
	/**
	* Utility method to round a float number
	*/
	static int round(float value);
	/**
	* Utility method to validate positive int format
	*/
	static bool validatePositiveInt(string s);
	/**
	* Utility method to validate float format
	*/
	static bool validateFloat(string s);
	/**
	* Utility method to validate address range format
	*/
	static bool validateAddressRange(string s);
	/**
	* Utility method to convert form "," to "."
	*/
	static void comaToDot(string& s);
	/**
	* Utility method to convert a float from negative to positive
	*/
	static string negativeToPositive(string s);
	/**
	* Utility method to convert a integer to string
	*/
	static string intToString(int i);
	/**
	* Utility method to convert a string with the format "adress1-address2" to 2 integers
	*/
	static int* stringAddressTokenize(string str, char addressRangeSeparator);
	/**
	* Utility method to validate the way type of an edge
	*/
	static bool validateWayType(string s);
	/**
	* Utility method to validate the object type of a MapObject
	*/
	static bool validateObjectType(string s);

	/**
	* Get value from configuration file
	*/
	static string getConfigurationValue(string key);
};
#endif /*UTILS_H_*/
